home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / teco.zip / VERIFY.C < prev    next >
C/C++ Source or Header  |  1986-07-15  |  938b  |  45 lines

  1. #include <ctype.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. verify()
  6. {
  7. #include "teco.h"
  8.  
  9.     int tmp;                /* First  scratch */
  10.     int wrk;                /* Second scratch */
  11.  
  12.     number=abs(number);            /* Take magnitude */
  13.     tmp=bufptx;                /* Save temporary */
  14.     wrk=number;                /* Save   counter */
  15.     while (1) {                /* Position back  */
  16.         if (!tmp) goto type;        /* Scan back line */
  17.         if (toascii(buffer[--tmp]) == 13) {
  18.             if (! --wrk) {
  19.                 if (toascii(buffer[tmp+1]) == 10){
  20.                     tmp++;
  21.                 }
  22.                 goto type;
  23.             }
  24.         }
  25.     }
  26. type:    wrk=bufptx;                /* Save  context  */
  27.     while (1) {                /* Position front */
  28.         if (wrk > bufptr) {        /* Type out stuff */
  29.             while (++tmp < wrk) {
  30.                 echo(buffer[tmp]);
  31.             }
  32.             return;        /* all done  type */
  33.         }
  34.         if (toascii(buffer[++wrk]) == 13) {
  35.             if (toascii(buffer[tmp]) == 10) ++wrk;
  36.             if (! --number) {
  37.                 while (tmp++ < wrk) {
  38.                     echo(buffer[tmp]);
  39.                 }
  40.                 return;
  41.             }
  42.         }
  43.     }
  44. }
  45.